<?
    class Principio_Library_Common
    {
        public static $error_list;
        public static $is_error;
        public static $msg;

        public static function init()
        {
            self::$error_list = array();
            self::$is_error = false;
            self::$msg = "";
        }


        public static function printErrorsAndMsg()
        {
            if (self::$is_error)
            {
?>
    <div class="error">
        <ul type="circle" style="padding-left: 20px;">
<?
            foreach (self::$error_list as $error_msg)
                echo "<li>".$error_msg."</li>";
?>
        </ul>
    </div>
    <?
            };

            if (self::$msg != "")
            {
?>
    <div class="msg">
                <?=self::$msg ?>
    </div>
<?
            };
        }

        public static function reportValidationFails($error_msg)
        {
            self::$is_error = true;
            self::$error_list[] = $error_msg;

            return false;
        }

        public static function checkValidity($test_passed, $error_msg)
        {
            if (!$test_passed)
                self::reportValidationFails($error_msg);

            return $test_passed;
        }


        public static function printRightTopMenu(&$menu)
        {

        }
    };
?>

